using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

using FreeFlow;
using FreeFlow.Administration;
using FreeFlow.WinFormsControls.HelperClasses;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for ActionControl.
	/// </summary>
  public class ActionControl : System.Windows.Forms.UserControl
  {
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label nameLabel;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label priorityLabel;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label fromStageLabel;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Label toStageLabel;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.Label typeLabel;
    private System.Windows.Forms.CheckBox cloneFolderCheckBox;
    private System.Windows.Forms.Label label7;
    private System.Windows.Forms.TextBox alertMessageLabel;
    private System.Windows.Forms.CheckBox reopenFolderCheckbox;
    private System.Windows.Forms.Label label10;
    private System.Windows.Forms.TextBox raiseFlagLabel;
    private System.Windows.Forms.TextBox whenActionStartedLabel;
    private System.Windows.Forms.Label label12;
    private System.Windows.Forms.TextBox whenActionCompletedLabel;
    private System.Windows.Forms.Label label13;
    private System.Windows.Forms.TextBox afterTimeValueLabel;
    private System.Windows.Forms.Label afterTimeLabel;
    private System.Windows.Forms.Label loopbackOptionValueLabel;
    private System.Windows.Forms.Label loopbackOptionLabel;
    private System.Windows.Forms.Label formValueLabel;
    private System.Windows.Forms.Label userActionTypeValueLabel;
    private System.Windows.Forms.TextBox availableToValueLabel;
    private System.Windows.Forms.TextBox chainedActionValueLabel;
    private System.Windows.Forms.Label chainedActionLabel;
    private System.Windows.Forms.Label availableToLabel;
    private System.Windows.Forms.Label formLabel;
    private System.Windows.Forms.Label userActionTypeLabel;
    private System.Windows.Forms.TextBox triggeredByFlagValueLabel;
    private System.Windows.Forms.Label triggeredByFlagLabel;
    private System.Windows.Forms.Label fieldUsageLabel;
    private System.Windows.Forms.Label groupLabel;
    private System.Windows.Forms.TextBox groupValueLabel;
    private System.Windows.Forms.Label descriptionLabel;
    private System.Windows.Forms.Label descriptionValueLabel;
    private FreeFlowAdministrator.UIActionsControl uiActionsControl;
    private FreeFlowAdministrator.FieldUsageControl fieldUsageControl;
    /// <summary> 
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;

    public ActionControl()
    {
      // This call is required by the Windows.Forms Form Designer.
      InitializeComponent();
    }

    /// <summary> 
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
      if( disposing )
      {
        if(components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

    #region Component Designer generated code
    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.label1 = new System.Windows.Forms.Label();
      this.nameLabel = new System.Windows.Forms.Label();
      this.label2 = new System.Windows.Forms.Label();
      this.priorityLabel = new System.Windows.Forms.Label();
      this.label3 = new System.Windows.Forms.Label();
      this.fromStageLabel = new System.Windows.Forms.Label();
      this.label4 = new System.Windows.Forms.Label();
      this.toStageLabel = new System.Windows.Forms.Label();
      this.formLabel = new System.Windows.Forms.Label();
      this.formValueLabel = new System.Windows.Forms.Label();
      this.label6 = new System.Windows.Forms.Label();
      this.typeLabel = new System.Windows.Forms.Label();
      this.cloneFolderCheckBox = new System.Windows.Forms.CheckBox();
      this.label7 = new System.Windows.Forms.Label();
      this.alertMessageLabel = new System.Windows.Forms.TextBox();
      this.chainedActionLabel = new System.Windows.Forms.Label();
      this.chainedActionValueLabel = new System.Windows.Forms.TextBox();
      this.reopenFolderCheckbox = new System.Windows.Forms.CheckBox();
      this.triggeredByFlagLabel = new System.Windows.Forms.Label();
      this.triggeredByFlagValueLabel = new System.Windows.Forms.TextBox();
      this.label10 = new System.Windows.Forms.Label();
      this.raiseFlagLabel = new System.Windows.Forms.TextBox();
      this.availableToLabel = new System.Windows.Forms.Label();
      this.availableToValueLabel = new System.Windows.Forms.TextBox();
      this.whenActionStartedLabel = new System.Windows.Forms.TextBox();
      this.label12 = new System.Windows.Forms.Label();
      this.whenActionCompletedLabel = new System.Windows.Forms.TextBox();
      this.label13 = new System.Windows.Forms.Label();
      this.afterTimeValueLabel = new System.Windows.Forms.TextBox();
      this.afterTimeLabel = new System.Windows.Forms.Label();
      this.loopbackOptionLabel = new System.Windows.Forms.Label();
      this.loopbackOptionValueLabel = new System.Windows.Forms.Label();
      this.fieldUsageLabel = new System.Windows.Forms.Label();
      this.userActionTypeLabel = new System.Windows.Forms.Label();
      this.userActionTypeValueLabel = new System.Windows.Forms.Label();
      this.groupLabel = new System.Windows.Forms.Label();
      this.groupValueLabel = new System.Windows.Forms.TextBox();
      this.descriptionLabel = new System.Windows.Forms.Label();
      this.descriptionValueLabel = new System.Windows.Forms.Label();
      this.uiActionsControl = new FreeFlowAdministrator.UIActionsControl();
      this.fieldUsageControl = new FreeFlowAdministrator.FieldUsageControl();
      this.SuspendLayout();
      // 
      // label1
      // 
      this.label1.Location = new System.Drawing.Point(8, 8);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(40, 16);
      this.label1.TabIndex = 0;
      this.label1.Text = "Name:";
      // 
      // nameLabel
      // 
      this.nameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.nameLabel.Location = new System.Drawing.Point(136, 8);
      this.nameLabel.Name = "nameLabel";
      this.nameLabel.Size = new System.Drawing.Size(632, 16);
      this.nameLabel.TabIndex = 1;
      this.nameLabel.Text = "nameLabel";
      // 
      // label2
      // 
      this.label2.Location = new System.Drawing.Point(8, 72);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(48, 16);
      this.label2.TabIndex = 2;
      this.label2.Text = "Priority:";
      // 
      // priorityLabel
      // 
      this.priorityLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.priorityLabel.Location = new System.Drawing.Point(136, 72);
      this.priorityLabel.Name = "priorityLabel";
      this.priorityLabel.Size = new System.Drawing.Size(632, 16);
      this.priorityLabel.TabIndex = 3;
      this.priorityLabel.Text = "priorityLabel";
      // 
      // label3
      // 
      this.label3.Location = new System.Drawing.Point(8, 40);
      this.label3.Name = "label3";
      this.label3.Size = new System.Drawing.Size(64, 16);
      this.label3.TabIndex = 4;
      this.label3.Text = "From stage:";
      // 
      // fromStageLabel
      // 
      this.fromStageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.fromStageLabel.Location = new System.Drawing.Point(136, 40);
      this.fromStageLabel.Name = "fromStageLabel";
      this.fromStageLabel.Size = new System.Drawing.Size(632, 16);
      this.fromStageLabel.TabIndex = 5;
      this.fromStageLabel.Text = "fromStageLabel";
      // 
      // label4
      // 
      this.label4.Location = new System.Drawing.Point(8, 56);
      this.label4.Name = "label4";
      this.label4.Size = new System.Drawing.Size(56, 16);
      this.label4.TabIndex = 6;
      this.label4.Text = "To stage:";
      // 
      // toStageLabel
      // 
      this.toStageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.toStageLabel.Location = new System.Drawing.Point(136, 56);
      this.toStageLabel.Name = "toStageLabel";
      this.toStageLabel.Size = new System.Drawing.Size(632, 16);
      this.toStageLabel.TabIndex = 7;
      this.toStageLabel.Text = "toStageLabel";
      // 
      // formLabel
      // 
      this.formLabel.Location = new System.Drawing.Point(8, 88);
      this.formLabel.Name = "formLabel";
      this.formLabel.Size = new System.Drawing.Size(40, 16);
      this.formLabel.TabIndex = 8;
      this.formLabel.Text = "Form:";
      // 
      // formValueLabel
      // 
      this.formValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.formValueLabel.Location = new System.Drawing.Point(136, 88);
      this.formValueLabel.Name = "formValueLabel";
      this.formValueLabel.Size = new System.Drawing.Size(632, 16);
      this.formValueLabel.TabIndex = 9;
      this.formValueLabel.Text = "formValueLabel";
      // 
      // label6
      // 
      this.label6.Location = new System.Drawing.Point(8, 24);
      this.label6.Name = "label6";
      this.label6.Size = new System.Drawing.Size(32, 16);
      this.label6.TabIndex = 11;
      this.label6.Text = "Type:";
      // 
      // typeLabel
      // 
      this.typeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.typeLabel.Location = new System.Drawing.Point(136, 24);
      this.typeLabel.Name = "typeLabel";
      this.typeLabel.Size = new System.Drawing.Size(632, 16);
      this.typeLabel.TabIndex = 12;
      this.typeLabel.Text = "typeLabel";
      // 
      // cloneFolderCheckBox
      // 
      this.cloneFolderCheckBox.Enabled = false;
      this.cloneFolderCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.cloneFolderCheckBox.Location = new System.Drawing.Point(8, 176);
      this.cloneFolderCheckBox.Name = "cloneFolderCheckBox";
      this.cloneFolderCheckBox.Size = new System.Drawing.Size(104, 16);
      this.cloneFolderCheckBox.TabIndex = 13;
      this.cloneFolderCheckBox.Text = "Clone Folder";
      // 
      // label7
      // 
      this.label7.Location = new System.Drawing.Point(8, 160);
      this.label7.Name = "label7";
      this.label7.Size = new System.Drawing.Size(100, 16);
      this.label7.TabIndex = 14;
      this.label7.Text = "Alert message:";
      // 
      // alertMessageLabel
      // 
      this.alertMessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.alertMessageLabel.BackColor = System.Drawing.SystemColors.Control;
      this.alertMessageLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.alertMessageLabel.Location = new System.Drawing.Point(136, 160);
      this.alertMessageLabel.Name = "alertMessageLabel";
      this.alertMessageLabel.ReadOnly = true;
      this.alertMessageLabel.Size = new System.Drawing.Size(632, 13);
      this.alertMessageLabel.TabIndex = 15;
      this.alertMessageLabel.Text = "alertMessageLabel";
      // 
      // chainedActionLabel
      // 
      this.chainedActionLabel.Location = new System.Drawing.Point(8, 216);
      this.chainedActionLabel.Name = "chainedActionLabel";
      this.chainedActionLabel.Size = new System.Drawing.Size(88, 16);
      this.chainedActionLabel.TabIndex = 16;
      this.chainedActionLabel.Text = "Chained action:";
      // 
      // chainedActionValueLabel
      // 
      this.chainedActionValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.chainedActionValueLabel.BackColor = System.Drawing.SystemColors.Control;
      this.chainedActionValueLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.chainedActionValueLabel.Location = new System.Drawing.Point(136, 216);
      this.chainedActionValueLabel.Name = "chainedActionValueLabel";
      this.chainedActionValueLabel.ReadOnly = true;
      this.chainedActionValueLabel.Size = new System.Drawing.Size(632, 13);
      this.chainedActionValueLabel.TabIndex = 17;
      this.chainedActionValueLabel.Text = "chainedActionValueLabel";
      // 
      // reopenFolderCheckbox
      // 
      this.reopenFolderCheckbox.Enabled = false;
      this.reopenFolderCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.reopenFolderCheckbox.Location = new System.Drawing.Point(8, 192);
      this.reopenFolderCheckbox.Name = "reopenFolderCheckbox";
      this.reopenFolderCheckbox.TabIndex = 18;
      this.reopenFolderCheckbox.Text = "Reopen Folder";
      // 
      // triggeredByFlagLabel
      // 
      this.triggeredByFlagLabel.Location = new System.Drawing.Point(8, 232);
      this.triggeredByFlagLabel.Name = "triggeredByFlagLabel";
      this.triggeredByFlagLabel.Size = new System.Drawing.Size(100, 16);
      this.triggeredByFlagLabel.TabIndex = 19;
      this.triggeredByFlagLabel.Text = "Triggered by flag:";
      // 
      // triggeredByFlagValueLabel
      // 
      this.triggeredByFlagValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.triggeredByFlagValueLabel.BackColor = System.Drawing.SystemColors.Control;
      this.triggeredByFlagValueLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.triggeredByFlagValueLabel.Location = new System.Drawing.Point(136, 232);
      this.triggeredByFlagValueLabel.Name = "triggeredByFlagValueLabel";
      this.triggeredByFlagValueLabel.ReadOnly = true;
      this.triggeredByFlagValueLabel.Size = new System.Drawing.Size(632, 13);
      this.triggeredByFlagValueLabel.TabIndex = 20;
      this.triggeredByFlagValueLabel.Text = "triggeredByFlagValueLabel";
      // 
      // label10
      // 
      this.label10.Location = new System.Drawing.Point(8, 248);
      this.label10.Name = "label10";
      this.label10.Size = new System.Drawing.Size(72, 16);
      this.label10.TabIndex = 21;
      this.label10.Text = "Raise flag:";
      // 
      // raiseFlagLabel
      // 
      this.raiseFlagLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.raiseFlagLabel.BackColor = System.Drawing.SystemColors.Control;
      this.raiseFlagLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.raiseFlagLabel.Location = new System.Drawing.Point(136, 248);
      this.raiseFlagLabel.Name = "raiseFlagLabel";
      this.raiseFlagLabel.ReadOnly = true;
      this.raiseFlagLabel.Size = new System.Drawing.Size(632, 13);
      this.raiseFlagLabel.TabIndex = 22;
      this.raiseFlagLabel.Text = "raiseFlagLabel";
      // 
      // availableToLabel
      // 
      this.availableToLabel.Location = new System.Drawing.Point(8, 264);
      this.availableToLabel.Name = "availableToLabel";
      this.availableToLabel.Size = new System.Drawing.Size(72, 16);
      this.availableToLabel.TabIndex = 23;
      this.availableToLabel.Text = "Available to:";
      // 
      // availableToValueLabel
      // 
      this.availableToValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.availableToValueLabel.Location = new System.Drawing.Point(136, 264);
      this.availableToValueLabel.Multiline = true;
      this.availableToValueLabel.Name = "availableToValueLabel";
      this.availableToValueLabel.ReadOnly = true;
      this.availableToValueLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.availableToValueLabel.Size = new System.Drawing.Size(632, 40);
      this.availableToValueLabel.TabIndex = 24;
      this.availableToValueLabel.Text = "availableToValueLabel";
      // 
      // whenActionStartedLabel
      // 
      this.whenActionStartedLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.whenActionStartedLabel.Location = new System.Drawing.Point(136, 312);
      this.whenActionStartedLabel.Multiline = true;
      this.whenActionStartedLabel.Name = "whenActionStartedLabel";
      this.whenActionStartedLabel.ReadOnly = true;
      this.whenActionStartedLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.whenActionStartedLabel.Size = new System.Drawing.Size(632, 40);
      this.whenActionStartedLabel.TabIndex = 25;
      this.whenActionStartedLabel.Text = "whenActionStartedLabel";
      // 
      // label12
      // 
      this.label12.Location = new System.Drawing.Point(8, 312);
      this.label12.Name = "label12";
      this.label12.Size = new System.Drawing.Size(112, 16);
      this.label12.TabIndex = 26;
      this.label12.Text = "When action started:";
      // 
      // whenActionCompletedLabel
      // 
      this.whenActionCompletedLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.whenActionCompletedLabel.Location = new System.Drawing.Point(136, 360);
      this.whenActionCompletedLabel.Multiline = true;
      this.whenActionCompletedLabel.Name = "whenActionCompletedLabel";
      this.whenActionCompletedLabel.ReadOnly = true;
      this.whenActionCompletedLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.whenActionCompletedLabel.Size = new System.Drawing.Size(632, 40);
      this.whenActionCompletedLabel.TabIndex = 27;
      this.whenActionCompletedLabel.Text = "whenActionCompletedLabel";
      // 
      // label13
      // 
      this.label13.Location = new System.Drawing.Point(8, 360);
      this.label13.Name = "label13";
      this.label13.Size = new System.Drawing.Size(128, 16);
      this.label13.TabIndex = 28;
      this.label13.Text = "When action completed:";
      // 
      // afterTimeValueLabel
      // 
      this.afterTimeValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.afterTimeValueLabel.Location = new System.Drawing.Point(136, 408);
      this.afterTimeValueLabel.Multiline = true;
      this.afterTimeValueLabel.Name = "afterTimeValueLabel";
      this.afterTimeValueLabel.ReadOnly = true;
      this.afterTimeValueLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.afterTimeValueLabel.Size = new System.Drawing.Size(632, 40);
      this.afterTimeValueLabel.TabIndex = 29;
      this.afterTimeValueLabel.Text = "afterTimeValueLabel";
      // 
      // afterTimeLabel
      // 
      this.afterTimeLabel.Location = new System.Drawing.Point(8, 408);
      this.afterTimeLabel.Name = "afterTimeLabel";
      this.afterTimeLabel.Size = new System.Drawing.Size(128, 16);
      this.afterTimeLabel.TabIndex = 30;
      this.afterTimeLabel.Text = "After time:";
      // 
      // loopbackOptionLabel
      // 
      this.loopbackOptionLabel.Location = new System.Drawing.Point(8, 456);
      this.loopbackOptionLabel.Name = "loopbackOptionLabel";
      this.loopbackOptionLabel.Size = new System.Drawing.Size(100, 16);
      this.loopbackOptionLabel.TabIndex = 31;
      this.loopbackOptionLabel.Text = "Loopback option:";
      // 
      // loopbackOptionValueLabel
      // 
      this.loopbackOptionValueLabel.Location = new System.Drawing.Point(136, 456);
      this.loopbackOptionValueLabel.Name = "loopbackOptionValueLabel";
      this.loopbackOptionValueLabel.Size = new System.Drawing.Size(312, 16);
      this.loopbackOptionValueLabel.TabIndex = 32;
      this.loopbackOptionValueLabel.Text = "loopbackOptionValueLabel";
      // 
      // fieldUsageLabel
      // 
      this.fieldUsageLabel.Location = new System.Drawing.Point(8, 480);
      this.fieldUsageLabel.Name = "fieldUsageLabel";
      this.fieldUsageLabel.Size = new System.Drawing.Size(100, 16);
      this.fieldUsageLabel.TabIndex = 33;
      this.fieldUsageLabel.Text = "Field usage:";
      // 
      // userActionTypeLabel
      // 
      this.userActionTypeLabel.Location = new System.Drawing.Point(8, 104);
      this.userActionTypeLabel.Name = "userActionTypeLabel";
      this.userActionTypeLabel.Size = new System.Drawing.Size(100, 16);
      this.userActionTypeLabel.TabIndex = 35;
      this.userActionTypeLabel.Text = "User action type:";
      // 
      // userActionTypeValueLabel
      // 
      this.userActionTypeValueLabel.Location = new System.Drawing.Point(136, 104);
      this.userActionTypeValueLabel.Name = "userActionTypeValueLabel";
      this.userActionTypeValueLabel.Size = new System.Drawing.Size(320, 16);
      this.userActionTypeValueLabel.TabIndex = 36;
      this.userActionTypeValueLabel.Text = "userActionTypeValueLabel";
      // 
      // groupLabel
      // 
      this.groupLabel.Location = new System.Drawing.Point(8, 120);
      this.groupLabel.Name = "groupLabel";
      this.groupLabel.Size = new System.Drawing.Size(100, 16);
      this.groupLabel.TabIndex = 37;
      this.groupLabel.Text = "Group:";
      // 
      // groupValueLabel
      // 
      this.groupValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.groupValueLabel.Location = new System.Drawing.Point(136, 120);
      this.groupValueLabel.Name = "groupValueLabel";
      this.groupValueLabel.Size = new System.Drawing.Size(632, 20);
      this.groupValueLabel.TabIndex = 38;
      this.groupValueLabel.Text = "groupValueLabel";
      // 
      // descriptionLabel
      // 
      this.descriptionLabel.Location = new System.Drawing.Point(8, 144);
      this.descriptionLabel.Name = "descriptionLabel";
      this.descriptionLabel.Size = new System.Drawing.Size(100, 16);
      this.descriptionLabel.TabIndex = 39;
      this.descriptionLabel.Text = "Description:";
      // 
      // descriptionValueLabel
      // 
      this.descriptionValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.descriptionValueLabel.Location = new System.Drawing.Point(136, 144);
      this.descriptionValueLabel.Name = "descriptionValueLabel";
      this.descriptionValueLabel.Size = new System.Drawing.Size(632, 16);
      this.descriptionValueLabel.TabIndex = 40;
      this.descriptionValueLabel.Text = "descriptionValueLabel";
      // 
      // uiActionsControl
      // 
      this.uiActionsControl.Actions = null;
      this.uiActionsControl.Dock = System.Windows.Forms.DockStyle.Right;
      this.uiActionsControl.Location = new System.Drawing.Point(778, 0);
      this.uiActionsControl.Name = "uiActionsControl";
      this.uiActionsControl.Size = new System.Drawing.Size(150, 616);
      this.uiActionsControl.TabIndex = 42;
      // 
      // fieldUsageControl
      // 
      this.fieldUsageControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
        | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.fieldUsageControl.Location = new System.Drawing.Point(136, 480);
      this.fieldUsageControl.Name = "fieldUsageControl";
      this.fieldUsageControl.Size = new System.Drawing.Size(632, 120);
      this.fieldUsageControl.TabIndex = 43;
      // 
      // ActionControl
      // 
      this.Controls.Add(this.fieldUsageControl);
      this.Controls.Add(this.uiActionsControl);
      this.Controls.Add(this.descriptionValueLabel);
      this.Controls.Add(this.descriptionLabel);
      this.Controls.Add(this.groupValueLabel);
      this.Controls.Add(this.groupLabel);
      this.Controls.Add(this.userActionTypeValueLabel);
      this.Controls.Add(this.userActionTypeLabel);
      this.Controls.Add(this.fieldUsageLabel);
      this.Controls.Add(this.loopbackOptionValueLabel);
      this.Controls.Add(this.loopbackOptionLabel);
      this.Controls.Add(this.afterTimeLabel);
      this.Controls.Add(this.afterTimeValueLabel);
      this.Controls.Add(this.label13);
      this.Controls.Add(this.whenActionCompletedLabel);
      this.Controls.Add(this.label12);
      this.Controls.Add(this.whenActionStartedLabel);
      this.Controls.Add(this.availableToValueLabel);
      this.Controls.Add(this.availableToLabel);
      this.Controls.Add(this.raiseFlagLabel);
      this.Controls.Add(this.label10);
      this.Controls.Add(this.triggeredByFlagValueLabel);
      this.Controls.Add(this.triggeredByFlagLabel);
      this.Controls.Add(this.reopenFolderCheckbox);
      this.Controls.Add(this.chainedActionValueLabel);
      this.Controls.Add(this.chainedActionLabel);
      this.Controls.Add(this.alertMessageLabel);
      this.Controls.Add(this.label7);
      this.Controls.Add(this.cloneFolderCheckBox);
      this.Controls.Add(this.typeLabel);
      this.Controls.Add(this.label6);
      this.Controls.Add(this.formValueLabel);
      this.Controls.Add(this.formLabel);
      this.Controls.Add(this.toStageLabel);
      this.Controls.Add(this.label4);
      this.Controls.Add(this.fromStageLabel);
      this.Controls.Add(this.label3);
      this.Controls.Add(this.priorityLabel);
      this.Controls.Add(this.label2);
      this.Controls.Add(this.nameLabel);
      this.Controls.Add(this.label1);
      this.Name = "ActionControl";
      this.Size = new System.Drawing.Size(928, 616);
      this.ResumeLayout(false);

    }
    #endregion

    private Action action;
    public void LoadAction(Action action)
    {
      this.action = action;
      nameLabel.Text = action.Name;
      priorityLabel.Text = action.Priority.ToString();
      fromStageLabel.Text = action.FromStage;
      toStageLabel.Text = action.ToStage;

      // user action stuff
      formValueLabel.Visible = action.ActionType == ActionType.User;
      formLabel.Visible = action.ActionType == ActionType.User; 
      formValueLabel.Text = action.Form;
      userActionTypeLabel.Visible = action.ActionType == ActionType.User;
      userActionTypeValueLabel.Visible = action.ActionType == ActionType.User;
      userActionTypeValueLabel.Text = action.UserActionType.ToString();
      availableToLabel.Visible = action.ActionType == ActionType.User;
      availableToValueLabel.Visible = action.ActionType == ActionType.User;
      availableToValueLabel.Text = action.AvailableTo;
      reopenFolderCheckbox.Visible = action.ActionType == ActionType.User;
      reopenFolderCheckbox.Checked = action.ReopenFolder;
      chainedActionLabel.Visible = action.ActionType == ActionType.User;
      chainedActionValueLabel.Visible = action.ActionType == ActionType.User;
      chainedActionValueLabel.Text = action.ChainedAction;

      // field usage
      fieldUsageLabel.Visible = action.ActionType == ActionType.User; 
      fieldUsageControl.Visible = action.ActionType == ActionType.User;
      fieldUsageControl.LoadFieldUsage(action.FieldUsage);

      // flagged actions
      triggeredByFlagLabel.Visible = action.ActionType == ActionType.Flagged;
      triggeredByFlagValueLabel.Visible = action.ActionType == ActionType.Flagged;
      triggeredByFlagValueLabel.Text = action.TriggeredByFlag;

      typeLabel.Text = action.ActionType.ToString();
      cloneFolderCheckBox.Checked = action.CloneFolder;
      alertMessageLabel.Text = action.AlertMessage;
      raiseFlagLabel.Text = action.RaiseFlag;
      whenActionStartedLabel.Text = action.WhenStarted;
      whenActionCompletedLabel.Text = action.WhenCompleted;
      afterTimeValueLabel.Text = action.AfterTime;

      // loopback options
      loopbackOptionLabel.Visible = action.IsLoopback;
      loopbackOptionValueLabel.Visible = action.IsLoopback;
      loopbackOptionValueLabel.Text = EnumDescription.GetDescription(action.LoopbackOption);

      // creation actions
      groupLabel.Visible = action.IsCreation && action.ActionType == ActionType.User;
      groupValueLabel.Visible = action.IsCreation && action.ActionType == ActionType.User;
      groupValueLabel.Text = action.Group;
      descriptionLabel.Visible = action.IsCreation && action.ActionType == ActionType.User;
      descriptionValueLabel.Visible = action.IsCreation && action.ActionType == ActionType.User;
      descriptionValueLabel.Text = action.Description;

      UIActionList actionList = new UIActionList();
      if (action.IsCreation && action.ActionType == ActionType.User)
        actionList.Add("Apply changes", "Apply any changes made", new ActionExecuteDelegate(ApplyChanges));
      if ((action.Form != null) && (action.Form.Length > 0) && (action.ActionType == ActionType.User))
        actionList.Add("Open form", "Open the form used in this action", new ActionExecuteDelegate(OpenForm));
      uiActionsControl.Actions = actionList;
    }

    private string OpenForm()
    {
      using (new CursorHandler())
      {
        FormForm formForm = new FormForm();
        Map map = new Map(action.Server, action.MapName);
        formForm.LoadForm(new FreeFlow.Administration.Form(action.Server, map.ProcedureName, action.Form));
        formForm.Show();
      }
      return null;
    }

    private string ApplyChanges()
    {
      action.Group = groupValueLabel.Text;
      action.ApplyChanges();
      return Constants.ChangesApplied;
    }
	}
}
